package com.jdy.haoduoaiteacher.model;

import java.util.Hashtable;

public class LeChatManager {
  private static LeChatManager mLeChatManager;
  // One user can communicate with different people,the key value is other
  // people's name.
  private Hashtable<String, LeConversation> conversationTable;

  private ChatOptions mChatOptions;

  private LeChatManager() {
    conversationTable = new Hashtable<String, LeConversation>();
  }

  public static LeChatManager getInstance() {
    // TODO Auto-generated method stub
    if (mLeChatManager == null) {
      mLeChatManager = new LeChatManager();
    }
    return mLeChatManager;
  }

  public void sendMessage(LeMessage message, LeMessageCallBack leMessageCallBack) {
    // TODO Auto-generated method stub

  }

  public void ackMessageRead(Object from, Object msgId) {
    // TODO Auto-generated method stub

  }

  public void asyncFetchMessage(LeMessage message) {
    // TODO Auto-generated method stub

  }

  public ChatOptions getChatOptions() {
    // TODO Auto-generated method stub
    if (mChatOptions == null) {
      mChatOptions = new ChatOptions();
    }
    return mChatOptions;
  }

  public void setMessageListened(LeMessage message) {
    // TODO Auto-generated method stub

  }

  /**
   * Given a username,ensure the adapter and the activity refer to exactly the
   * same `LeConversation`.
   * 
   * @param username
   * @return
   */
  public LeConversation getConversation(String username) {
    // TODO Auto-generated method stub
    if (conversationTable.containsKey(username))
      return conversationTable.get(username);
    else {
      LeConversation lc = new LeConversation(username);
      conversationTable.put(username, lc);
      return lc;
    }
  }

  public Object getIncomingVoiceCallBroadcastAction() {
    // TODO Auto-generated method stub
    return null;
  }

}
